home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
HyperLib 1997 Winter - Disc 1
/
HYPERLIB-1997-Winter-CD1.ISO.7z
/
HYPERLIB-1997-Winter-CD1.ISO
/
オンラインウェア
/
BUS
/
TMCM Software and Labs.sit
/
Software for TMCM 7_95
/
Files for Lab 11
/
Symmetry Subs
< prev
next >
Wrap
Text File
|
1993-10-31
|
4KB
|
226 lines
{ This file defines subroutines for drawing "symmetric"
pictures. The subroutines
multiForward(dist)
multiBack(dist)
multiArc(radius,degrees)
multiCircle(radius)
multiMove(dx,dy)
multiMoveTo(x,y)
can be used as replacements for the usual subroutines
forward, back, arc, circle, move and moveTo. Instead of
drawing a single line or arc, these "mulit" subroutines draw
eight things: the ususal one and all its horizontal and
vertical reflections. To make a symmetric picture, put
your program at the end of this file and use these
subroutines in place of the usual ones.
NOTE: You don't have to read the definitions of these
subroutines or understand how they work in order
to use them. Just use them as "black boxes."
}
{--------------- Definitions of Subroutines ----------------}
SUB multiforward(d)
IF isDrawing = 0 THEN
forward(d)
RETURN
END IF
DECLARE save_heading, save_x, save_y
save_heading := heading
save_x := xcoord
save_y := ycoord
penUp
moveTo(-save_y, save_x)
penDown
face(90 + save_heading)
forward(d)
penUp
moveTo(save_y, -save_x)
penDown
face(-90 + save_heading)
forward(d)
penUp
moveTo(-save_y, -save_x)
penDown
face(-90 - save_heading)
forward(d)
penUp
moveTo(save_y,save_x)
penDown
face(90 - save_heading)
forward(d)
penUp
moveTo(save_x, -save_y)
penDown
face(-save_heading)
forward(d)
penUp
moveTo(-save_x, save_y)
penDown
face(180 - save_heading)
forward(d)
penUp
moveTo(-save_x, -save_y)
penDown
face(180 + save_heading)
forward(d)
penUp
moveTo(save_x,save_y)
penDown
face(save_heading)
forward(d)
END SUB
SUB multiarc(r,d)
IF isDrawing = 0 THEN
arc(r,d)
RETURN
END IF
DECLARE save_heading, save_x, save_y
save_heading := heading
save_x := xcoord
save_y := ycoord
penUp
moveTo(-save_y, save_x)
penDown
face(90 + save_heading)
arc(r,d)
penUp
moveTo(save_y, -save_x)
penDown
face(-90 + save_heading)
arc(r,d)
penUp
moveTo(-save_y, -save_x)
penDown
face(-90 - save_heading)
arc(-r,d)
penUp
moveTo(save_y,save_x)
penDown
face(90 - save_heading)
arc(-r,d)
penUp
moveTo(save_x, -save_y)
penDown
face(-save_heading)
arc(-r,d)
penUp
moveTo(-save_x, save_y)
penDown
face(180 - save_heading)
arc(-r,d)
penUp
moveTo(-save_x, -save_y)
penDown
face(180 + save_heading)
arc(r,d)
penUp
moveTo(save_x,save_y)
penDown
face(save_heading)
arc(r,d)
END SUB
SUB multiMoveTo(x,y)
IF isDrawing = 0 THEN
MoveTo(x,y)
RETURN
END IF
DECLARE save_heading, save_x, save_y
save_heading := heading
save_x := xcoord
save_y := ycoord
penUp
moveTo(-save_y, save_x)
penDown
moveTo(-y,x)
penUp
moveTo(save_y, -save_x)
penDown
moveTo(y,-x)
penUp
moveTo(-save_y, -save_x)
penDown
moveTo(-y,-x)
penUp
moveTo(save_y,save_x)
penDown
moveTo(y,x)
penUp
moveTo(save_x, -save_y)
penDown
moveTo(x,-y)
penUp
moveTo(-save_x, save_y)
penDown
moveTo(-x,y)
penUp
moveTo(-save_x, -save_y)
penDown
moveTo(-x,-y)
penUp
moveTo(save_x,save_y)
penDown
moveTo(x,y)
END SUB
SUB multiback(d)
multiforward(-d)
END SUB
SUB multicircle(r)
multiarc(r,360)
END SUB
SUB multiMove(dx,dy)
multiMoveTo(xcoord + dx, xcoord + dy)
END SUB
{------------ End of Subroutine Definitions ------------------}